#include <stdio.h>

struct A {
	A(){}
	virtual void a(){}
	virtual void b(){}
};

struct B : A{
	B(){}
	virtual void a(){}
	virtual void b(){}
};


struct Foo {
	Foo() {
		bar();
	}
	void bar() {
		foo();
	}
	virtual void foo() = 0;
};

struct Bar: public Foo {
	Bar() {
	}
	virtual void foo() {}
};

int main() {
	B b;
	A a;
	A c;
	printf("%d\n", *((unsigned *)(&a)));
	printf("%d\n", *((unsigned *)(&c)));
	printf("%d\n", *((unsigned *)(&b)));

	printf("\nvtable B\n");
	unsigned * vtableElem = *((unsigned **)(&b));
	for(int i = 0; i < 5; ++i){
		printf("%d\n", *vtableElem++);
	}

	printf("\nvtable A\n");
	vtableElem = *((unsigned **)(&a));
	for(int i = 0; i < 5; ++i){
		printf("%d\n", *vtableElem++);
	}

	new Bar();
	return 0;
}
